package com.iakuil.app.domain.entity;

import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iakuil.app.common.core.annotation.Unique;
import com.iakuil.app.common.core.domain.BaseEntity;
import com.iakuil.app.common.db.handler.ToLongArrayHandler;
import lombok.*;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 书籍实体类
 *
 * @author Kai
 * @date 2023-11-28
 **/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "t_book", autoResultMap = true)
public class Book extends BaseEntity<Book> {

    /**
     * 标题
     */
    private String title;

    /**
     * 作者ID
     */
    @TableField(typeHandler = ToLongArrayHandler.class)
    private Long[] authorIds;

    /**
     * 出版社ID
     */
    private Long pressId;

    /**
     * ISBN
     */
    @Unique("ISBN编码重复")
    private String isbn;

    /**
     * 简介
     */
    @TableField(condition = SqlCondition.LIKE_RIGHT)
    private String introduction;

    /**
     * 价格
     */
    private BigDecimal price;

    /**
     * 出版日期
     */
    private Date publishDate;
}
